#include <bits/stdc++.h>

#include <atcoder/all>
#define LL long long
using namespace std;
using namespace atcoder;

struct State {
  int len, link;
  int next[26];

  State() {
    fill(next, next + 26, -1);
  }
};

struct SAM {
  vector<State> st;
  int sz, last, n;

  void sam_init() {
    st[0].len = 0;
    st[0].link = -1;
    sz = 1;
    last = 0;
  }
  void sam_extend(int c) {
    int cur = sz++;
    st[cur].len = st[last].len + 1;
    int p = last;
    while (p != -1 && st[p].next[c] == -1) {
      st[p].next[c] = cur;
      p = st[p].link;
    }
    if (p == -1) {
      st[cur].link = 0;
    } else {
      int q = st[p].next[c];
      if (st[p].len + 1 == st[q].len) {
        st[cur].link = q;
      } else {
        int clone = sz++;

        st[clone] = st[q];
        st[clone].len = st[p].len + 1;
        while (p != -1 && st[p].next[c] == q) {
          st[p].next[c] = clone;
          p = st[p].link;
        }
        st[q].link = st[cur].link = clone;
      }
    }
    last = cur;
  }
  SAM(string s) {
    n = s.size();
    st.resize(n * 2);
    sam_init();
    for (int i = 0; i < s.size(); i++) {
      sam_extend(s[i] - 'a');
    }
  }

  string GetAns() {
    vector<vector<int>> no(n + 1);
    vector<bool> sg(sz, false);

    for (int i = 0; i < sz; i++) {
      no[st[i].len].push_back(i);
    }
    for (int i = n; i >= 0; i--) {
      for (int sta : no[i]) {
        for (int c = 0; c < 26; c++) {
          if (st[sta].next[c] != -1 && !sg[st[sta].next[c]]) {
            sg[sta] = true;
            break;
          }
        }
      }
    }
    return sg[0] ? "Alice" : "Bob";
  }
};

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int T;

  for (cin >> T; T; T--) {
    string s;

    cin >> s;

    SAM sam(s);
    cout << sam.GetAns() << "\n";
  }
  return 0;
}
